﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class ajax_sort_top20 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string result = "<table width=290 id=\"top20\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style='BORDER-COLLAPSE: collapse;font-size: 11pt;' bordercolor=\"#cfdfff\" align=\"center\">";

        result += "<tr>";
        result += "<td align=center width=30>排名</td><td align=right width=50>人数</td><td align=center>姓名</td>";
        result += "</tr>";
        result += "<tbody>";
        int orderby = 1;
        string sSql = "select top 10 bigname,myemail,count(*) as linkmans from vw_linkman where bigname<>'汽车画报' and bigname<>'管理员' group by bigname,myemail order by count(*) desc";
        TSqlDBReader oTop20 = new TSqlDBReader(sSql);
        while (oTop20.FDataReader.Read())
        {
            result += "<tr>";
            result += "<td align=center width=30>" + orderby.ToString() + "</td>";
            result += "<td align=right width=50>" + oTop20.FDataReader.GetValue(2).ToString() + "</td>";
            result += "<td>&nbsp;&nbsp;&nbsp;" + oTop20.FDataReader.GetValue(0).ToString() + "</td>";
            //result += "<td>" + oTop20.FDataReader.GetValue(0).ToString() + "(" + oTop20.FDataReader.GetValue(1).ToString() + ")</td>";
            result += "</tr>";

            orderby++;
        }
        oTop20.Free();
        result += "</tbody>";

        result += "</table>";

        top20.Text = result;
    }
}
